package tech.aistar.service.impl;

import org.apache.ibatis.annotations.Select;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import tech.aistar.entity.Com;
import tech.aistar.mapper.ComMapper;
import tech.aistar.service.IComService;

import java.util.List;

/**
 * Created by Administrator on 2019/10/7.
 */
@Service
@Transactional
public class ComServiceImpl implements IComService {
    @Autowired
    private ComMapper comMapper;

    @Override
    public List<Com> findAllComment() {
        return comMapper.findAllComment();
    }

    @Override
    public List<Com> findAllByPostId(Integer postId) {
        return comMapper.findAllByPostId(postId);
    }

    @Override
    public Com findComByComId(Integer comId) {
        return comMapper.findComByComId(comId);
    }

    @Override
    public List<Com> findOneComment(Integer postId) {
        return comMapper.findOneComment(postId);
    }

    @Override
    public Long findAllComNum() {
        return comMapper.findAllComNum();
    }

    @Override
    public Long findOneComNum(Integer postId) {
        return comMapper.findOneComNum(postId);
    }

    @Override
    public List<Com> findAllTwoComment(Integer floor, Integer postId) {
        return comMapper.findAllTwoComment(floor,postId);
    }

    @Override
    public List<Com> findTwoComment(Integer floor, Integer flag, Integer postId) {
        return comMapper.findTwoComment(floor,flag,postId);
    }

    @Override
    public Long findTwoCount(Integer floor, Integer postId) {
        return comMapper.findTwoCount(floor,postId);
    }

    @Override
    public Long findAllByUserId(Integer userId) {
        return comMapper.findAllByUserId(userId);
    }

    @Override
    public Long findAllByToUserId(Integer toUserId) {
        return comMapper.findAllByToUserId(toUserId);
    }

    @Override
    public Long findComNumByTheme(Integer themeId) {
        return comMapper.findComNumByTheme(themeId);
    }

    @Override
    public void saveComment(Com com) {
        comMapper.saveComment(com);
    }
}
